from webdav4.client import Client
import sys


class webDavUtil:
    def uploadFile(self, local_file_path, remote_folder):
        client = Client(base_url='http://124.221.66.3:5244/dav/',
                        auth=('admin', 'wsllx@2024'))
        print('客户端连接成功\n')
        client.upload_file(local_file_path, remote_folder, overwrite=True)
        print('上传成功\n')

    def downloadFile(self, local_file_path, remote_folder):
        client = Client(base_url='http://124.221.66.3:5244/dav/',
                        auth=('admin', 'wsllx@2024'))
        print('客户端连接成功\n')
        client.download_file(remote_folder, local_file_path)
        print('下载成功\n')

if __name__ == '__main__':
    webDavUtil().uploadFile("D:/temp2/test.txt", "/夸克/paper/test.txt")
    sys.exit(0)
